package stream.demo1;

import java.util.stream.Collectors;
import java.util.stream.IntStream;

/**
 * @author ZH
 * https://www.jianshu.com/p/0c07597d8311
 */
public class StreamTest2 {
    public static void main(String[] args) {
        //可以替换掉传统的fori循环
        /*for (int i = 1; i < 10; i++) {
            System.out.println(i);
        }*/
        IntStream.range(1,10).forEach(System.out::println);
        IntStream.range(1,10).mapToObj(t -> "a" + t).forEach(System.out::print);
        System.out.println();
        IntStream.range(1,10).mapToObj(t -> "a" + t).collect(Collectors.toList()).forEach(System.out::print);
    }
}
